<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title>扫描结果</title>
		<link rel="stylesheet" type="text/css" href="./css/hui.css" />
		<style type="text/css">
			body {
				padding: 0px;
				margin: 0px;
				background: #EAEAEC;
			}

			.line {
				height: 20px;
			}

			/* 添加/修改样式  */
			.hui-header {
				background: rgba(248, 248, 248, 0.82);
			}

			.hui-header h1 {
				font-size: 17px;
			}

			.title {
				width: 100px;
				height: 40px;
				line-height: 40px;
				position: absolute;
				left: 50%;
				margin-left: -50px;
				font-size: 17px;
				color: #030303;
			}

			#hui-back:before {
				color: #2439A5;
			}

			.tit_bar {
				height: 47px;
				line-height: 47px;
				text-align: center;
				color: #333333;
				font-size: 16px;
			}

			.message {
				height: 47px;
				line-height: 47px;
				background: #FFFFFF;
				position: relative;
				border-bottom: 1px solid #EAEAEC;
			}

			.message_left {
				width: 120px;
				display: inline-block;
				padding-left: 16px;
				color: #333333;
				font-size: 17px;
			}

			.message_right {
				position: absolute;
				right: 0px;
				width: 170px;
				padding-right: 16px;
				text-align: right;
				color: #999999;
			}

			.btn {
				margin: 0px 16px;
				margin-top: 48px;
				height: 47px;
				background: #2439A5;
				padding: 0px 16px;
				border-radius: 24px;
				line-height: 47px;
				text-align: center;
				font-size: 18px;
				color: #FFFFFF;
			}

			/* 遮罩 */
			.shade {
				position: fixed;
				top: 44px;
				background: rgba(0, 0, 0, 0.5);
				left: 0px;
				right: 0px;
				bottom: 0px;
			}

			.hint {
				width: 230px;
				height: 78px;
				background: rgba(255, 255, 255, 1);
				border-radius: 2px;
				position: fixed;
				left: 50%;
				top: 230px;
				margin-left: -120px;
				word-break: break-all;
				padding: 10px;
				padding-bottom: 0px;
				box-sizing: border-box;
			}

			.show {
				display: none;
			}
		</style>
	</head>

	<body>
		<header class="hui-header">
			<!--<div onClick="gotoActivity()" id="hui-back"></div>-->
			<span class="title">扫描结果</span>
		</header>
		<div class="hui-wrap">
			<div class="tit_bar" id="h_name"></div>
			<div class="message">
				<span class="message_left">信用代码</span>
				<span id="h_code" class="message_right"></span>
			</div>
			<div class="message">
				<span class="message_left">地址</span>
				<span id="h_address" class="message_right"></span>
			</div>
			<div class="message">
				<span class="message_left">付费方式</span>
				<span class="message_right">微信支付</span>
			</div>
			<!--<div class="message">-->
			<!--<span class="message_left">我的余额</span>-->
			<!--<span class="message_right">0.00元</span>-->
			<!--</div>-->
			<div class="message">
				<span class="message_left">付费金额</span>
				<span id="h_monery" class="message_right">0.00元</span>
			</div>
			<div id="ev" class="btn"></div>

			<!-- 遮罩层 -->
			<!--<div class="shade show"></div>-->
			<!--<div class="hint show">你的实名信息已经推送到实名认证系统，酒店管理人员确认信息后即可开始办理酒店入住手续。</div>-->
		</div>
		<script src="./js/jquery.min.js"></script>
		<script src="js/fastclick.js"></script>
		<script>
			$(function() {
				FastClick.attach(document.body);
			});
		</script>

		<script src="./js/chen-url.js"></script>
		<script src="./js/hui.js" type="text/javascript" charset="utf-8"></script>
		<script>
			hui('#ev').click(function() {
				// if (hui(this).buttonIsLoading()) {
				// 	return false;
				// }
				// hui(this).loadingButton('加载中...');
				// setTimeout(function() {
				// 	hui('#ev').resetLoadingButton();
				// }, 2000);

				var hid = GetQueryString("id");
				if (je != 0) {
					nativeMethod.wxPay(localStorage.getItem("id"), hid, je, htype);
				} else {
					hui.alert('提交成功！', '好的', function() {
						nativeMethod.freeScan(localStorage.getItem("id"), hid, htype)
					});

				}
			});
			var je = 0;
			var htype = 0;
			hui.ready(function() {

				<!--$.ajax({-->
				<!--type: 'post',-->
				<!--url: testHttel,-->
				<!--data: {id:GetQueryString("id")},-->
				<!--dataType: 'jsonp',-->
				<!--success: function (data) {-->
				<!--console.log(msg);-->
				<!--hui('#h_name').html(msg.h_name);-->
				<!--hui('#h_code').html(msg.h_code);-->
				<!--hui('#h_address').html(msg.h_address);-->
				<!--hui('#h_monery').html(msg.h_monery);-->
				<!--},-->
				<!--error: function (data) {-->
				<!--hui.iconToast('获取酒店信息失败，请重新扫描！', 'warn');-->
				<!--}-->
				<!--});-->

				<!--hui('#content').html(GetQueryString("id"));-->
				// 根据酒店id查询

				if (GetQueryString("id") == "000000000000") {
					hui.iconToast('获取酒店信息失败，请重新扫描！', 'warn');
				} else {
					$.ajax({
						type: "POST",
						dataType: "json",
						url: testHttel,
						data: {
							id: GetQueryString("id")
						},
						success: function(msg) {
							je = msg.h_monery;
							htype = msg.h_type;
							hui('#h_name').html(msg.h_name);
							hui('#h_code').html(msg.h_code);
							hui('#h_address').html(msg.h_address);
							hui('#h_monery').html((msg.h_monery / 100) + " 元");

							if (je == 0) {
								hui('#ev').html('免费提交');
							} else {
								hui('#ev').html('微信支付');
							}
						},
						error: function(XMLHttpRequest, textStatus, errorThrown) {
							if (XMLHttpRequest.readyState == 4) {
								hui.iconToast('服务器内部错误', 'warn');
								// HTTP error (can be checked by XMLHttpRequest.status and XMLHttpRequest.statusText)
							} else if (XMLHttpRequest.readyState == 0) {
								// Network error (i.e. connection refused, access denied due to CORS, etc.)
								hui.iconToast('网络异常', 'warn');
								countdown = 0;
							} else {
								// something weird is happening
								hui.iconToast('服务异常', 'warn');
							}
						}
					});
				}


				<!--hui.iconToast(localStorage.getItem("id"), 'warn');-->
				<!--$.ajax({-->
				<!--type: "get",-->
				<!--dataType: "json",-->
				<!--url: address + "user/getCode?uid=" + localStorage.getItem("id")-->
				<!--});-->


				<!--document.querySelector('.shade').classList.remove("show");-->
				<!--document.querySelector('.hint').classList.remove("show");-->

				<!--setInterval(function() {-->
				<!--document.querySelector('.shade').classList.add("show");-->
				<!--document.querySelector('.hint').classList.add("show");-->
				<!--}, 2000);-->

			});

			function GetQueryString(name) {
				var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
				var r = window.location.search.substr(1).match(reg);
				if (r != null) return decodeURI(r[2]);
				return null;
			}

			function gotoActivity() {
				var hid = GetQueryString("id");
				if (je != 0) {
					nativeMethod.wxPay(localStorage.getItem("id"), hid, je, htype);
				} else {
					hui.alert('免费提交！', '好的', function() {
						nativeMethod.freeScan(localStorage.getItem("id"), hid, htype)
					});

				}
			}
		</script>

	</body>

</html>
